#include <Kharlia/Engine/Common.h>
#include <Kharlia/Engine/RenderView.h>
#include <Kharlia/Engine/Units.h>
#include <Kharlia/Engine/Engine.h>
#include <Kharlia/Engine/Client.h>
#include <Kharlia/Engine/Actor.h>

namespace kharlia { namespace engine {

const ui::String FRenderView::WidgetTypeName("Kharlia/RenderView");

FRenderView::FRenderView(const ui::String& type, const ui::String& name):
    Window(type, name),
    mDrawEveryFrame(true),
    mCamera() {
}
    
void FRenderView::onSized(ui::WindowEventArgs& e) {
}

void FRenderView::onMouseMove(ui::MouseEventArgs& e) {
}

void FRenderView::onMouseButtonUp(ui::MouseEventArgs& e) {
}
void FRenderView::onMouseButtonDown(ui::MouseEventArgs& e) {
}

void FRenderView::onKeyDown(ui::KeyEventArgs &e) {
    //switch (e.scancode) {
    //case ui::Key::W:
    //    GEngine->MoveCamera(FVector3F(0.0f, -1.2f, 0.0));
    //    break;
    //case ui::Key::A:
    //    GEngine->MoveCamera(FVector3F(-1.2f, 0.0f, 0.0f));
    //    break;
    //case ui::Key::S:
    //    GEngine->MoveCamera(FVector3F(0.0f, 1.2f, 0.0f));
    //    break;
    //case ui::Key::D:
    //    GEngine->MoveCamera(FVector3F(1.2f, 0.0f, 0.0f));
    //    break;
    //}
}

void FRenderView::onKeyUp(ui::KeyEventArgs &e) {
}

void FRenderView::drawSelf(const ui::RenderingContext& context) {
    CEngine::GetInstancePtr()->GetClient()->OnRenderViewDraw(*this, context);
}

}}